package com.ljz.service.impl;

import com.ljz.dao.UserDao;
import com.ljz.dao.impl.UserDaoImpl;
import com.ljz.entity.User;
import com.ljz.service.UserService;

public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();


    @Override
    public User findByUid(Integer uid) {
        return userDao.findByUid(uid);
    }

    @Override
    public boolean findByUname(User user) {
        User user1 = userDao.findByUname(user.getUname());
        if(user1 == null){
            return false;
        }
        if(user.getPassword().equals(user1.getPassword())){
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public boolean checkName(String uname) {
        return userDao.checkName(uname);
    }
}
